<%@ page language="java" pageEncoding="utf8"%>
<jsp:include page="/head_admin.jsp" />
<script type="text/javascript" src="script/news.js"></script>
<script type="text/javascript">
	dojo.require("dijit.form.DateTextBox");
	
   	dojo.addOnLoad(function(){
  		News.askForNewsInfo();
  		dijit.byId("newsGrid").resize();
   	});
   	
   	var manageAllNews = {
       	items:[]
    };
    
	var manageNewsStore = new dojo.data.ItemFileWriteStore({data:manageAllNews});
	
    function editNews(newsId) {
		document.getElementById("newsId").value=newsId;
		dijit.byId("editNewsDlg").show();
	}
	
	function deleteNews(newsId) {
		if(confirm("确认删除该快讯？")==true) {
			var href = "deleteNews.do?newsId="+newsId;
			ajaxRequest(href, updateNewsStore, null);
		}
	}
	
	function updateNewsStore(ajax_request) {
		var item = dijit.byId("newsGrid").removeSelectedRows();
		manageNewsStore.deleteItem(item);
	}

</script>
<style type="text/css">
	#newsGrid{
		width:98%;
	}
	.dojoxGrid table {
        margin: 0;
        font-size: 12px;
        text-align: center;
    }
</style>
<div class="maincontent">
  <div class="HackBox"></div>
	<div id="breadcrumb">
		&nbsp;
		<a href="index.jsp">主页</a>&nbsp;&gt;&nbsp;
		<a href="movieManage.jsp">影院管理</a>&nbsp;&gt;&nbsp;影院快讯管理
	</div>
	  <div class="maincontentin">
		<div class="addBook_div">
			<span class="addBook_bar"> <span class="left"></span> 
			<span class="addMovie_icon">&nbsp;影院快讯管理&nbsp;</span></span>
			 <table class="addBookTable">
			  <tr>
				<td colspan="3">
					<div id="adminGridDiv">
								<table dojoType="dojox.grid.DataGrid" id="newsGrid" selectionMode="single"
								 style="background:#E9F6FD none repeat scroll 0 0; padding-left:10px" autoHeight="true" store="manageNewsStore">
									<thead>
										<tr>
											<th field="newsTitle" width="10%">快讯题目</th>
											<th field="newsContent" width="50%">快讯内容</th>
											<th field="newsPublisher" width="8%">发布者</th>
											<th field="newsDate" width="12%">发布时间</th>
											<th field="editNews" width="10%">编辑</th>
									 		<th field="deleteNews" width="10%">删除</th>
										</tr>
									</thead>
								  </table>
							</div>
						</td>
					</tr>
				</table>
		</div>
	</div>

	<div id="editNewsDlg"
	style="display: none;width:60%; height: 220px;"
	dojoType="dijit.Dialog" title='编辑影院快讯' class="pop-window">
	<form action="editNews.do" method="post">
		<table>
				<tr>
					<td class="label" style="width:13%; padding:5 0"><span style="color:red">*</span>快讯题目： 
					</td>
					<td >
						<input dojoType="dijit.form.ValidationTextBox" id="newsTitle"
							name='newsTitle' required="true" invalidMessage="请输入快讯题目" />
					</td>
				</tr>
				<tr>
					<td class="label" style="padding:5 0"><span style="color:red">*</span>快讯内容：
					</td>
					<td>
							<input dojoType="dijit.form.ValidationTextBox" id="newsContent"
							name='newsContent' required="true" invalidMessage="请输入快讯内容" />
							
						</td>
				</tr>
				<tr>
					<td style="padding-left:40px">
						<input type="hidden" id="newsId" name="newsId" value="1">
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<div class="buttonbar">
							<div class="btngroup">
								<span class="blue-btn"> <span class="inputbtn"> <span
										class="l"></span> <input type="submit" value='保存'></input> </span> </span>
							</div>
						</div>
					</td>
				</tr>
		</table>
	</form>
</div>

<jsp:include page="footer.jsp" />
